<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>一朵 - 我的积分</title>
  <!-- swiper-2.7css -->
    <link rel="stylesheet" href="__STATIC__/index/js/swiper/idangerous.swiper.css">
  <!-- swiper-2.7js -->
    <script src="__STATIC__/index/js/swiper/idangerous.swiper.min.js"></script>
  <!-- jquery-3.2.1引用 -->
    <script src="__STATIC__/index/js/global/jquery-3.2.1.min.js"></script>
  <!-- 阿里巴巴矢量图库 -->
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_561814_yo33l6f1qxhl4n29.css">
  <!-- 公共头部 脚部 -->
    <link rel="stylesheet" href="__STATIC__/index/css/global/global.css">
  <!-- 超过1200屏幕 -->
    <link rel="stylesheet" media="screen and (min-width: 1200px)" href="__STATIC__/index/css/integral/integral1200.css" />
  <!-- 1080-1200 -->
    <link rel="stylesheet" media="screen  and (min-width: 1080px) and (max-width: 1199px) " href="__STATIC__/index/css/integral/integral1080.css"
    />
  <!-- 960-1080 -->
    <link rel="stylesheet" media="screen  and (min-width: 960px) and (max-width: 1079px) " href="__STATIC__/index/css/integral/integral960.css"
    />
  <!-- 768-959 -->
    <link rel="stylesheet" media="screen  and (min-width: 768px) and (max-width: 959px) " href="__STATIC__/index/css/integral/integral768.css"
    />
  <!-- 568-767 -->
    <link rel="stylesheet" media="screen  and (min-width: 568px) and (max-width: 767px) " href="__STATIC__/index/css/integral/integral568.css"
    />
  <!-- 375-567 -->
    <link rel="stylesheet" media="screen  and (min-width: 375px) and (max-width: 567px) " href="__STATIC__/index/css/integral/integral375.css"
    />
  <!-- 小于375-->
    <link rel="stylesheet" media="screen  and (max-width: 374px) " href="__STATIC__/index/css/integral/integral320.css" />
  <!--一引入layer-->
    <script src="__STATIC__/layer/layer.js"></script>
    {include file="public/page_css" /}
</head>

<body>

    <div class="M">
        <div class="m-header">
            <div>
                <span onclick="go_back();">
                    <span class="iconfont icon-xiangzuo" ></span>
                    返回
                </span>
                <span>积分明细</span>
                <span>
                    {if condition="!empty($realname)"}
                        <a href="{:url('User/index')}" class="my" >
                            {$realname}
                        </a>
                    {else /}
                        <a href="{:url('Login/loginin')}">登录</a>
                        <a href="{:url('Login/register')}">注册</a>
                    {/if}
                    <a href="{:url('MyCart/my_cart')}" class="car">
                        <span class="iconfont icon-gouwuche"></span>
                        <span>{$cart_num}</span>
                    </a>
                </span>
            </div>

        </div>
        <div class="m-message">
            <div>
                <span>
                    <img src="{if condition='empty($user.logo)'}__STATIC__/index/img/shanchu/touxiang.jpg{else /}{$user.logo}{/if}" alt="">
                </span>
                <span>
                    <p>{$realname}</p>
                    <p>当前积分：{$user.pay_points}</p>
                </span>
                <span>
                    <a href="{:url('User/my_point_rank')}">查看我的排名</a>
                </span>
            </div>
        </div>
      <!-- 循环开始 -->
        {foreach name="list" item="v"}
            <div class="m-list">
                <div>
                    <p>
                        <span>
                            {if condition="empty($v.type_cn)"}
                                消费赠送积分
                            {else /}
                                {$v.type_cn}
                            {/if}
                        </span>
                        <span>
                            <span>
                                {if condition="$v.type eq 0"}
                                {$v.point}
                                {else /}
                                +{$v.point}
                                {/if}
                            </span>
                            <span>{$v.addtime|date="Y.m.d",###}</span>
                        </span>
                    </p>
                </div>
            </div>
        {/foreach}
        <div class="m-finish">
            {if condition="$cur_page eq $all_page"}
                <p>没有更多了</p>
                <p>...</p>
            {/if}
        </div>
      <!-- 循环结束 -->
    </div>

    <!------------------------ PC ------------------------>

    <div class="PC">
        <!-- 公共头部 -->
        {include file="public/p_header" /}
        <!-- 公共头部结束 -->
        <div class="pc-content">
            {include file="public/p_user" /}

            <div class="PC_right">
                {include file="public/p_user_info" /}
                <div class="pc-tihuan">
                    <div class="pc-tihuan-headline">
                        <div>
                            <p>
                                {$store.title}>我的积分>积分明细
                            </p>
                        </div>
                    </div>
                    <div class="pc-bill">
                        <!-- 循环开始 -->
                        {foreach name="list" item="v"}
                            <div>
                                <p>
                                    <span>
                                        <span>
                                            {if condition="!empty($v.type_cn)"}
                                                {$v.type_cn}
                                            {else /}
                                                消费赠送积分
                                            {/if}
                                        </span>
                                        <span>
                                            {if condition="$v.type eq 0"}

                                            {else /}
                                            +
                                            {/if}
                                            {$v.point}
                                        </span>
                                    </span>
                                    <span>
                                        {$v.addtime|date="Y.m.d",###}
                                    </span>
                                </p>
                            </div>
                        {/foreach}
                        <!-- 循环结束 -->
                    </div>
                </div>
            </div>
        </div>
        <div class="pc-Flip pages" style="text-align: center;">
            {$page}
        </div>
        <!-- 公共脚部  -->
        {include file="public/p_footer" /}
        <!-- 公共脚部 结束 -->

    </div>
    <div style="display:none;" id="cur_page">{$cur_page}</div>
    <div style="display:none" id="all_page">{$all_page}</div>
    <script>
        $(window).scroll(function () {
            console.log($(document).scrollTop());
            console.log($(document).height());
            console.log($(window).height());
            console.log($(document).height() - $(window).height() -1);
            if ($(document).scrollTop() >= $(document).height() - $(window).height() -1) {
                var cur_page = parseInt($('#cur_page').text());       //当前页码
                var all_page = parseInt($('#all_page').text());       //当前页码
                if(all_page != cur_page){
                    $.post("{:url('User/get_ajax_point_log')}",
                        {cur_page:cur_page},
                        function(data){
                            if(data.code == 1){
                                var html = '';
                                for(var i=0;i<data.data.length;i++){
                                    if(data.data[i]['type_cn'] == ''){
                                        type_cn = '消费赠送积分';
                                    }else{
                                        type_cn = data.data[i]['type_cn'];
                                    }

                                    if(data.data[i]['type'] == 0){
                                        type = '-';
                                    }else{
                                        type = '+';
                                    }

                                    html +='<div class="m-list"><div><p><span>'+type_cn+'</span><span><span>'+type+data.data[i]["point"]+'</span><span>'+data.data[i]["add_time"]+'</span></span></p></div></div>';
                                }
                                $('.m-finish').before(html);
                                $('#cur_page').text(data.msg);
                                if(cur_page+1 == all_page){
                                    $('.m-finish').append('<p>没有更多了</p><p>...</p>');
                                }
                            }
                        }
                    );

                }
            }
        });

        /**
         * 返回上一页
         */
        function go_back(){
            window.history.back();  //返回上一页
        }

        /**
         * 完善会员信息
         */
        function edit_member_info(){
            window.location.href = "{:url('User/my_center')}";
        }
    </script>
</body>

</html>